;
(function() {

	var skill = {
		//可发送的用户列表
		getSendAbleUserList: function() {
			//注册会员
			var userlist_1 = this.getRegisterUserList();
			//参与分销活动的用户
			var userlist_2 = this.getBinaUserList();

			var userlist = userlist_1.concat(userlist_2);
			return userlist;
		},
		//发送邮件
		sendMailToUserList: function(mail_info) {
			var bus = this;
			var userlist = this.getSendAbleUserList();
			userlist.map(function(user) {
				user = $Object.clone(user);
				if (user.info.email) {
					var mailInfo = {
						to: user.info.email,
						title: "【多纳微站：" + bus.info.title + "】" + mail_info.title || "站内信",
						content: mail_sendmail_content.format({
							content: mail_info.content
						})
					};
					emailSender(mailInfo, function(error) {
						if (error) {
							user._is_mail_sended = true;
							console.error("新的订单提示邮件 发送失败", user.info.mail, error);
						} else {
							user._is_mail_sended = false;
							console.log("新的订单提示邮件 已经发送");
						}
					});
				}
				return user;
			});
		},
		//发送站内信
		//发送短信
	};
	module.exports = skill;
	var db = require("../db/index");
	var DomainCon = require("../domain/_con");
	var GoodsCon = require("../goods/_con");
	var UserCon = require("../../core/user/_con");
	var BusCon = require("../../core/bus/_con");
	var AchCon = require("../ach/_con");
	var ClassifyCon = require("../bus.classify/_con");
	var TagCon = require("../bus.tag/_con");
	var LeagueCon = require("../league/_con");
	var BuffCon = require("../buff/_con");
	var BusUserBindCon = require("../bus_user_bind/_con");
	var BusGuideCon = require("../bus.guide/_con");
	var CommentCon = require("../comment/_con");
	var config = require("../_include/config");
	var data_cut = require("../_include/data_cut");
	var helper = require("../_include/helper");
	var md5 = require("../_include/md5");
	var $Object = require("../_include/$.Object");
	var $Array = require("../_include/$.Array");
	var tld = require('tldjs');
	var Fiber = require('fibers');
	var fs = require("fs");
	var mail_sendmail_content = fs.readFileSync(__dirname + "/mail.sendmail.html").toString();
	var emailSender = require("../../core/_include/email");
}());